import { request } from '@/plugins/request'

/* 登录 */
export const login = data => {
  return request({
    url: '/api/users/login',
    method: 'POST',
    data: {
      user: data,
    },
  })
}

/* 注册 */
export const register = data => {
  return request({
    url: '/api/users',
    method: 'POST',
    data: {
      user: data,
    },
  })
}

/* 获取用户设置信息 */
export const getUser = () => {
  return request({
    url: '/api/user',
    method: 'GET',
  })
}

/* 更新用户设置信息 */
export const updateUser = data => {
  return request({
    url: '/api/user',
    method: 'PUT',
    data: {
      user: data,
    },
  })
}
